/*
 * @Description: 创建子元素
 * @Version: 2.0
 * @Autor: liuwei
 * @Date: 2021-05-30 09:38:02
 * @LastEditors: liuwei
 * @LastEditTime: 2021-05-30 09:43:04
 */
import {
  init,
  h
} from 'snabbdom'

const patch = init([])

let vnode = h('div#container', [
  h('h1', 'Hello Snabbdom'),
  h('p', '这是一个p')
])

let app = document.querySelector('#app')
let oldVnode = patch(app, vnode)

setTimeout(() => {
  // vnode = h('div#container', [
  //   h('h1', 'Hello World'),
  //   h('p', 'Hello p')
  // ])
  // patch(oldVnode, vnode)
  // 清除div里的内容  !是指空的注释节点
  patch(oldVnode, h('!'))
}, 2000);